//
//  SectionScoreTableViewCell.m
//  LotteryProject
//
//  Created by 阳光 on 17/7/10.
//  Copyright © 2017年 阳光. All rights reserved.
//

#import "SectionScoreTableViewCell.h"

@interface SectionScoreTableViewCell ()

@property(nonatomic,strong)UILabel *weekLabel;

@property(nonatomic,strong)UILabel *timeLabel;

@property(nonatomic,strong)UILabel *numberLabel;

@property(nonatomic,strong)UIImageView *arrowIcon;

@end

@implementation SectionScoreTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        // ➡️Cell类型
        self.accessoryType=UITableViewCellAccessoryNone;

        self.arrowIcon.hidden=NO;

        self.weekLabel.font=FontNumber(18);

        self.timeLabel.font=FontNumber(16);

        self.numberLabel.font=FontNumber(16);

        self.timeLabel.font=FontNumber(16);

        self.backgroundColor=WhiteColor;
    }
    return self;
}

// weekLabel
- (UILabel *)weekLabel
{

    if (!_weekLabel) {
        _weekLabel=[self getLabelWithText:@"周五" font:FontNumber(18) textColor:DarkGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_weekLabel];
        [_weekLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(kmargin);
            make.width.mas_equalTo(APPW/4-kmargin*2);
        }];
    }
    return _weekLabel;
}

// timeLabel
- (UILabel *)timeLabel
{
    if (!_timeLabel) {
        _timeLabel=[self getLabelWithText:@"2016-10-07" font:FontNumber(16) textColor:LightGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        [self.contentView addSubview:_timeLabel];
        [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(APPW/4);
            make.centerY.mas_equalTo(self.weekLabel.mas_centerY);
            make.width.mas_equalTo(APPW/4);
        }];
    }
    return _timeLabel;
}

- (UILabel *)numberLabel
{
    if (!_numberLabel) {
        _numberLabel=[self getLabelWithText:@"共15场比赛" font:FontNumber(16) textColor:LightGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        [self.contentView addSubview:_numberLabel];
        [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(APPW/2);
            make.centerY.mas_equalTo(self.weekLabel.mas_centerY);
            make.width.mas_equalTo(APPW/4);
        }];
    }
    return _numberLabel;
}

// arrowIcon
-(UIImageView *)arrowIcon
{
    if (!_arrowIcon) {
        _arrowIcon=[UIImageView new];
        _arrowIcon.backgroundColor=MainColor;
        [self.contentView addSubview:_arrowIcon];
        _arrowIcon.image=[UIImage imageNamed:@"next_arrow"];
        [_arrowIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-kmargin*2);
            make.centerY.mas_equalTo(self);
            make.size.mas_equalTo(CGSizeMake(kmargin,kmargin*2));
        }];
    }
    return _arrowIcon;
}

@end
